home *** CD-ROM | disk | FTP | other *** search
/ Venus 7000 / darktronics.iso / Software / Service Packs / Win2kSP4.exe / i386 / mmc.ex_ / mmc.exe / HTML / JSTSKPAD.JS < prev    next >
Encoding:
Text File  |  2003-06-19  |  23.8 KB  |  698 lines

  1. var L_UnrecognizedImageFormat_ErrorMessage = "Unrecognized image format for button index: ";
  2.  
  3.  
  4. //*************************************
  5. //GET DYNAMIC BODY AND WATERMARK STYLES
  6. //*************************************
  7.  
  8. function GetBodyAndWatermarkStyles()
  9. {
  10.     var szBodyBgColor;
  11.     var szWatermarkColor;
  12.     
  13.     // Set body and watermark depending on color depth
  14.     if (screen.colorDepth <= 8) {
  15.         szBodyBgColor = "background-color:window;\n";
  16.         szWatermarkColor = "color:threedlightshadow;\n";
  17.     }
  18.     else {
  19.         szBodyBgColor = "background-color:threedhighlight;\n";
  20.         szWatermarkColor = "color:threedshadow;filter:alpha(opacity=15);\n";
  21.     }
  22.  
  23.     var szStyle = "<style>\n";
  24.     szStyle += "Body\n";
  25.     szStyle += "  {\n";
  26.     szStyle += "  font-family:Verdana;\n";
  27.     szStyle += "  font-weight:normal;\n";
  28.     szStyle += "  cursor:default;\n";
  29.     szStyle += "  " + szBodyBgColor;
  30.     szStyle += "  }\n\n";
  31.  
  32.     szStyle += ".tdWatermark\n";
  33.     szStyle += "  {\n";
  34.     szStyle += "  text-align:center;\n";
  35.     szStyle += "  cursor:default;\n";
  36.     szStyle += "  " + szWatermarkColor;
  37.     szStyle += "  }\n";
  38.     szStyle += "</style>\n";
  39.     
  40.     return szStyle;
  41. }
  42.  
  43. //******************************
  44. // BUILD TASKPAD BUTTON FUNCTION
  45. //******************************
  46.  
  47. function BuildTaskpadButtons(iPageStyle)
  48. {
  49.     var szNextButton;
  50.  
  51.     for (var i = 0; i <= giTotalButtons; i++) {
  52.         szNextButton = GetNextButton (iPageStyle, i);
  53.           divSymbolContainer.insertAdjacentHTML ("BeforeEnd", szNextButton);
  54.     }
  55. }
  56.  
  57. //**************************
  58. // GET NEXT BUTTON FUNCTIONS
  59. //**************************
  60.  
  61. function GetNextButton(iPageStyle, theIndex)
  62. {
  63.     // Calculate the column & row placement of the button
  64.     // based on its index
  65.     var theColumn    = theIndex % giTotalColumns;                            // mod returns column
  66.     var theRow = Math.floor (theIndex / giTotalColumns);        // division returns row
  67.     
  68.     // Multiply row & column by offset base to determine relative placement
  69.     // of button in percentage terms.
  70.     switch (iPageStyle)
  71.     {
  72.         case CON_TASKPAD_STYLE_VERTICAL1:
  73.             // Vertical layout with 2 listviews
  74.             var iLeftLoc = theColumn * 52;            // columns are 52% apart in this layout
  75.             var iTopLoc = theRow * 25;                    // rows are 25% apart in this layout        
  76.             break;
  77.             
  78.         case CON_TASKPAD_STYLE_HORIZONTAL1:
  79.             // Horizontal layout with 1 listview
  80.             var iLeftLoc = theColumn * 25;            // columns are 25% apart in this layout
  81.             var iTopLoc = theRow * 52;                    // rows are 52% apart in this layout
  82.             break;
  83.             
  84.         case CON_TASKPAD_STYLE_NOLISTVIEW:
  85.             // Buttons-only layout (no listview)
  86.             var iLeftLoc = theColumn * 25;            // columns are 25% apart in this layout
  87.             var iTopLoc = theRow * 25;                    // rows are 25% apart in this layout
  88.             break;            
  89.     }
  90.     
  91.     // Get the HTML for the button
  92.     var szFormattedBtn;
  93.     szFormattedBtn = GetButtonHTML (gaiBtnObjectType[theIndex], theIndex, iLeftLoc, iTopLoc)
  94.     return szFormattedBtn;
  95. }
  96.  
  97. //*************************
  98. // GET BUTTON HTML FUNCTION
  99. //*************************
  100.  
  101. function EndHREFIfNecessary (theIndex, bWantAnchor)
  102. {
  103.     var szHREF = "";
  104.     if (gaiBtnActionType[theIndex] == 1) {
  105.         if (bWantAnchor == true)
  106.             szHREF += "</A>";
  107.     }
  108.     return szHREF;
  109. }
  110. function StartHREFIfNecessary (theIndex, bWantAnchor)
  111. {
  112.     var szHREF = "";
  113.     if (gaiBtnActionType[theIndex] == 1) {
  114.         // if it's a link, we can't use script to redirect
  115.         // because this impacts MMC's history list
  116.         if (bWantAnchor == true)
  117.             szHREF += "<A HREF=\"";
  118.         szHREF += gaszBtnActionURL[theIndex];
  119.         if (bWantAnchor == true)
  120.             szHREF += "\" STYLE=\"textdecoration\">";
  121.     }
  122.     return szHREF;
  123. }
  124. function GetButtonHTML(iBtnType, theIndex, iLeftLoc, iTopLoc)
  125. {
  126.     // Build up the HTML for the button
  127.     var szBtnHTML = "";
  128.     
  129.     switch (iBtnType)
  130.     {
  131.         case CON_TASK_DISPLAY_TYPE_SYMBOL:             // EOT-based symbol | font
  132.             szBtnHTML += "<DIV class=divSymbol id=divSymbol_" + theIndex + " style=\"LEFT: " + iLeftLoc + "%; TOP: " + iTopLoc + "%\">\n";
  133.             szBtnHTML += "<TABLE id=tblSymbol_" + theIndex + " border=0 cellPadding=0 cellSpacing=0 frame=none rules=none width=100%>\n";
  134.             szBtnHTML += "<TBODY>\n";
  135.             szBtnHTML += "<TR>\n";
  136.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdSymbol_" + theIndex + " noWrap vAlign=top>";
  137.             szBtnHTML += StartHREFIfNecessary (theIndex, true);
  138.             szBtnHTML += "<SPAN class=clsSymbolBtn id=spanSymbol_" + theIndex + " ";
  139.             szBtnHTML += "style=\"COLOR: \"threedhighlight\"; FONT-FAMILY: Webdings; FONT-SIZE: 68px; FONT-WEIGHT: normal\" TaskpadButton>";
  140.             szBtnHTML += "test<!--Insert here-->";
  141.             szBtnHTML += "</SPAN>";
  142.             szBtnHTML += EndHREFIfNecessary (theIndex, true);
  143.             szBtnHTML += "</TD></TR>\n";
  144.             szBtnHTML += "<TR>\n";
  145.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdSymbol_" + theIndex + " vAlign=top width=100%>";
  146.             szBtnHTML += "<A class=clsSymbolBtn href=\"";
  147.             szBtnHTML += StartHREFIfNecessary (theIndex, false);
  148.             szBtnHTML += "\" id=anchorCaption_" + theIndex + " ";
  149.             szBtnHTML += "style=\"COLOR: \"threedhighlight\"; FONT-SIZE: 18px; TEXT-DECORATION: none\" TaskpadButton>";
  150.             szBtnHTML += "<!--Insert here--></A></TD></TR></TBODY></TABLE></DIV><!--divSymbol_" + theIndex + "-->\n";
  151.             break;
  152.             
  153.         case CON_TASK_DISPLAY_TYPE_VANILLA_GIF:        // (GIF) index 0 is transparent
  154.         case CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF:      // (GIF) index 1 is transparent
  155.             // First get the Hex value of the CSS threedhighlight constant
  156.             var szMaskColor = SysColorX.HEXthreedshadow;
  157.     
  158.             szBtnHTML += "<DIV class=divSymbol id=divSymbol_" + theIndex + " style=\"LEFT: " + iLeftLoc + "%; TOP: " + iTopLoc + "%\">\n";
  159.             szBtnHTML += "<TABLE id=tblSymbol_" + theIndex + " border=0 cellPadding=0 cellSpacing=0 frame=none rules=none width=100%>\n";
  160.             szBtnHTML += "<TBODY>\n";
  161.             szBtnHTML += "<TR>\n";
  162.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdSymbol_" + theIndex + " noWrap vAlign=top>";
  163.             szBtnHTML += StartHREFIfNecessary (theIndex, true);
  164.             szBtnHTML += "<IMG class=clsTaskBtn height=250 id=imgTaskBtn_" + theIndex + " src=\"\" ";
  165.             szBtnHTML += "style=\"FILTER: mask(color=" + szMaskColor + "); HEIGHT: 66px; WIDTH: 66px\" width=250 TaskpadButton>";
  166.             szBtnHTML += EndHREFIfNecessary (theIndex, true);
  167.             szBtnHTML += "</TD></TR>\n";
  168.             szBtnHTML += "<TR>\n";
  169.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdAnchor_" + theIndex + " vAlign=top width=100% TaskpadButton>";
  170.             szBtnHTML += "<A class=clsSymbolBtn href=\"";
  171.             szBtnHTML += StartHREFIfNecessary (theIndex, false);
  172.             szBtnHTML += "\" id=anchorCaption_" + theIndex + " ";
  173.             szBtnHTML += "style=\"FONT-SIZE: 18px\" TaskpadButton>";
  174.             szBtnHTML += "<!--Insert Here--></A></TD></TR></TBODY></TABLE></DIV><!--divSymbol_" + theIndex + "-->\n";
  175.  
  176.             break;
  177.         
  178.         case CON_TASK_DISPLAY_TYPE_BITMAP:             // non-transparent raster image
  179.             szBtnHTML += "<DIV class=divSymbol id=divSymbol_" + theIndex + " style=\"LEFT: " + iLeftLoc + "%; TOP: " + iTopLoc + "%\">\n";
  180.             szBtnHTML += "<TABLE id=tblSymbol_" + theIndex + " border=0 cellPadding=0 cellSpacing=0 frame=none rules=none width=100%>\n";
  181.             szBtnHTML += "<TBODY>\n";
  182.             szBtnHTML += "<TR>\n";
  183.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdSymbol_" + theIndex + " noWrap vAlign=top>";
  184.             szBtnHTML += StartHREFIfNecessary (theIndex, true);
  185.             szBtnHTML += "<IMG class=clsTaskBtn height=250 id=imgTaskBtn_" + theIndex + " src=\"\" ";
  186.             szBtnHTML += "style=\"HEIGHT: 66px; WIDTH: 66px\" width=250 border=0 TaskpadButton>";
  187.             szBtnHTML += EndHREFIfNecessary (theIndex, true);
  188.             szBtnHTML += "</TD></TR>\n";
  189.             szBtnHTML += "<TR>\n";
  190.             szBtnHTML += "<TD align=middle class=tdSymbol id=tdSymbol_" + theIndex + " vAlign=top width=100%>";
  191.             szBtnHTML += "<A class=clsSymbolBtn href=\"";
  192.             szBtnHTML += StartHREFIfNecessary (theIndex, false);
  193.             szBtnHTML += "\" id=anchorCaption_" + theIndex + " ";
  194.             szBtnHTML += "style=\"FONT-SIZE: 18px\" TaskpadButton>";
  195.             szBtnHTML += "<!--Insert Here--></A></TD></TR></TBODY></TABLE></DIV><!--divSymbol_" + theIndex + "-->\n";            
  196.  
  197.             break;
  198.     }    
  199.     return szBtnHTML;
  200. }
  201.  
  202. //*********************************
  203. // COMMON BUTTON BUILDING FUNCTIONS
  204. //*********************************
  205.  
  206. function InsertButtonBitmaps()
  207. {
  208.     for (var i = 0; i <= giTotalButtons; i++) {
  209.         switch (gaiBtnObjectType[i])
  210.         {
  211.             case CON_TASK_DISPLAY_TYPE_VANILLA_GIF:        // (GIF) index 0 is transparent
  212.             case CON_TASK_DISPLAY_TYPE_CHOCOLATE_GIF:      // (GIF) index 1 is transparent
  213.             case CON_TASK_DISPLAY_TYPE_BITMAP:             // non-transparent raster image
  214.                 document.all("imgTaskBtn_" + i).src = gaszBtnOffBitmap[i];
  215.                 break;
  216.         }
  217.     }
  218. }
  219.  
  220. function InsertFontFamilyAndString()
  221. {
  222.     for (var i = 0; i <= giTotalButtons; i++) {
  223.         if (typeof(gaszFontFamilyName[i]) == "string") {
  224.             document.all("spanSymbol_" + i).style.fontFamily = gaszFontFamilyName[i];
  225.             document.all("spanSymbol_" + i).innerHTML = gaszSymbolString[i];
  226.         }
  227.     }
  228. }
  229.  
  230. function InsertCaptionText()
  231. {
  232.     // Insert caption text for each taskpad button
  233.     for (var i = 0; i <= giTotalButtons; i++) {
  234.         document.all("anchorCaption_" + i).innerHTML = gaszBtnCaptions[i];
  235.     }
  236. }
  237.  
  238. function EnableGrayscaleFilter()
  239. {
  240.     for (var i = 0; i <= giTotalButtons; i++) {
  241.         // Grayscale filter only applies to raster-based images
  242.         if (gaiBtnObjectType[i] == CON_TASK_DISPLAY_TYPE_BITMAP) {
  243.             // Grayscale filter only applies if gaszBtnOverBitmap[i] is undefined
  244.             if (typeof(gaszBtnOverBitmap[i]) == "undefined") {
  245.                 document.all("imgTaskBtn_" + i).style.filter = "gray";
  246.             }
  247.         }
  248.     }
  249. }
  250.  
  251. function InsertTaskpadText()
  252. {
  253.     // Insert text for taskpad title, description, and watermark
  254.     
  255.     // Use insertAdjacentText("AfterBegin") for divTitle so that we
  256.     // don't blow out the contained divAbout element
  257.     divTitle.insertAdjacentText("AfterBegin", gszTaskpadTitle);
  258.  
  259.     // Use innerHTML for elements below to support formatting (e.g. <br>)
  260.     // Use innerText for stand-alone elements
  261.     divDescription.innerHTML = gszTaskpadDescription;
  262.     
  263.     var objWatermark = MMCCtrl.GetBackground (szHash);
  264.  
  265.     if (objWatermark != null) {
  266.         // Keep track of the watermark display object type
  267.         giWatermarkObjectType = objWatermark.DisplayObjectType;
  268.  
  269.         switch (giWatermarkObjectType) {
  270.  
  271.             default:
  272.                 break;                                           
  273.  
  274.             case 1:
  275.                 // MMC_TASK_DISPLAY_TYPE_SYMBOL
  276.                 str = "";
  277.                 str += "<SPAN STYLE=\"position:absolute; top:5%; left:0; z-index:-20; font-size:300pt; font-family:";
  278.                 str += objWatermark.FontFamilyName;
  279.                 str += "; \">";
  280.                 str += objWatermark.SymbolString;
  281.                 str += "</SPAN>";
  282.                 tdWatermark.innerHTML = str;
  283.                 break;
  284.  
  285.             case 2:
  286.                 // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, index 0 is transparent
  287.                 tdWatermark.innerHTML = "<IMG SRC=\"" +
  288.                 objWatermark.MouseOffBitmap + 
  289.                 "\" STYLE=\"position:absolute; filter:alpha(opacity=20); left:0%; top:75%; overflow:hidden;\">";
  290.                 break;
  291.  
  292.             case 3:
  293.                 // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, index 1 is transparent
  294.                 tdWatermark.innerHTML = "<IMG SRC=\"" +
  295.                 objWatermark.MouseOffBitmap + 
  296.                 "\" STYLE=\"position:absolute; filter:alpha(opacity=20); left:0%; top:75%; overflow:hidden;\">";
  297.                 break;
  298.  
  299.             case 4:
  300.                 // MMC_TASK_DISPLAY_TYPE_BITMAP, non-transparent raster
  301.                 tdWatermark.innerHTML = "<IMG SRC=\"" +
  302.                 objWatermark.MouseOffBitmap + 
  303.                 "\" STYLE=\"position:absolute; filter:alpha(opacity=20); left:0%; top:80%; overflow:hidden;\">";
  304.                 break;
  305.         }
  306.     }
  307. }
  308.  
  309. function SetupListview()
  310. {
  311.     if (gbShowLVTitle == true) {        
  312.         // if gbShowLVTitle is true, add strings to listview
  313.         tdLVTitle.innerText = gszLVTitle;
  314.  
  315.         // Determine if author really wants to show the listview button
  316.         if (gbHasLVButton == true) {        
  317.             anchorLVButton_0.innerText = gszLVBtnCaption;
  318.         }
  319.         // If not, hide it
  320.         else {
  321.             divLVButton_0.style.visibility = "hidden";
  322.         }
  323.     }
  324.     else {
  325.         // gbShowLVTitle is false, so nothing has been specified for a listview header or button;
  326.         // hide these elements and let the listview occupy 100% of its parent"s height
  327.         divLVTitle.style.visibility= "hidden";
  328.         divLV.style.top = "0%";
  329.         divLV.style.height = "100%";
  330.     }
  331. }
  332.  
  333. //***************************************
  334. // BUTTON HIGHLIGHT/UNHIGHLIGHT FUNCTIONS
  335. //***************************************
  336.  
  337. function HighlightButton(szBtnIndex)
  338. {
  339.   // Determine button type
  340.   switch (gaiBtnObjectType[szBtnIndex])
  341.   {
  342.     case 1:     // Symbol
  343.       //document.all("spanSymbol_" + szBtnIndex).style.color = "highlight";
  344.             document.all("spanSymbol_" + szBtnIndex).style.color = "threeddarkshadow";
  345.       break;
  346.  
  347.     case 2:     // GIF Vanilla
  348.     case 3:     // GIF Chocolate
  349.             document.all("imgTaskBtn_" + szBtnIndex).filters.mask.color = SysColorX.RGBthreeddarkshadow;
  350.       break;
  351.  
  352.     case 4:     // Raster
  353.       if (typeof(gaszBtnOverBitmap[szBtnIndex]) == "string") {
  354.             // Use SRC swapping if an "OverBitmap" is specified
  355.           document.all("imgTaskBtn_" + szBtnIndex).src = gaszBtnOverBitmap[szBtnIndex];
  356.         }
  357.         else {
  358.             // Otherwise, toggle from grayscale to color for single bitmap
  359.           document.all("imgTaskBtn_" + szBtnIndex).filters[0].enabled = 0;
  360.         }
  361.         break;
  362.         
  363.     default:
  364.       alert (L_UnrecognizedImageFormat_ErrorMessage + szBtnIndex);
  365.       break;        
  366.   }
  367.  
  368.     document.all("anchorCaption_" + szBtnIndex).style.color = "threeddarkshadow";
  369.     document.all("anchorCaption_" + szBtnIndex).style.textDecoration = "underline";
  370.  
  371.     // Keep track of tooltip index and display tooltip
  372.     giTooltipIndex = szBtnIndex;
  373.  
  374.     // Show the tooltip after latency period specified by giTooltipLatency
  375.     gTooltipTimer = window.setTimeout("TaskpadTooltipShow()", giTooltipLatency, "jscript");
  376. }
  377.  
  378.  
  379. function UnhighlightButton()
  380. {
  381.   if (typeof(gszLastBtn) != "undefined") {
  382.  
  383.     // Determine button type
  384.     switch (gaiBtnObjectType[gszLastBtn])
  385.     {
  386.       case 1:     // Symbol                
  387.                 document.all("spanSymbol_" + gszLastBtn).style.color = "threedshadow";
  388.         break;
  389.  
  390.       case 2:     // GIF Vanilla
  391.       case 3:     // GIF Chocolate
  392.                 document.all("imgTaskBtn_" + gszLastBtn).filters.mask.color = SysColorX.RGBthreedshadow;
  393.         break;
  394.  
  395.       case 4:     // Raster
  396.         if (typeof(gaszBtnOverBitmap[gszLastBtn]) == "string") {
  397.               // Use SRC swapping if an "OverBitmap" is specified
  398.             document.all("imgTaskBtn_" + gszLastBtn).src = gaszBtnOffBitmap[gszLastBtn];
  399.           }
  400.           else {
  401.               // Otherwise, toggle from color to grayscale for single bitmap
  402.             document.all("imgTaskBtn_" + gszLastBtn).filters[0].enabled = 1;
  403.           }
  404.           break;
  405.           
  406.       default:
  407.         alert(L_UnrecognizedImageFormat_ErrorMessage + gszLastBtn);
  408.         break;        
  409.     }  
  410.  
  411.         document.all("anchorCaption_" + gszLastBtn).style.color = "threedshadow";
  412.         document.all("anchorCaption_" + gszLastBtn).style.textDecoration = "none";
  413.  
  414.         TaskpadTooltipHide();
  415.     }
  416. }
  417.  
  418. function IsStillOverButton()
  419. {
  420.     //  Purpose: Determines if a mouseover or mouseout event
  421.     //  was fired over the same button (indicating that the pointer
  422.     //  is still over the button and that highlighting/unhighlighting
  423.     //  should be ignored.
  424.     // 
  425.     //  Returns true if and only if:
  426.     //    * both fromElement and toElement are not null;
  427.     //    * both elements contain a user-defined "TaskpadButton" attribute;
  428.     //    * both element IDs match.
  429.     
  430.     var fromX = window.event.fromElement;
  431.     var toX = window.event.toElement;
  432.  
  433.     // Trap case where mouse pointer appeared over a button out of nowhere,
  434.     // (e.g. as a result of switching focus from another app).
  435.     if ((fromX != null) && (toX != null)) {
  436.         // return true if moving within elements of a single button
  437.         if ((fromX.getAttribute("TaskpadButton") != null) == (toX.getAttribute("TaskpadButton") != null)) {
  438.             if (GetElementIndex(fromX.id) == GetElementIndex(toX.id)) {
  439.                 return true;
  440.             }
  441.         }
  442.     }
  443.     return false;
  444. }
  445.  
  446. //*****************
  447. //TOOLTIP FUNCTIONS
  448. //*****************
  449.  
  450. function LoadTooltipPointer()
  451. {
  452.     divTooltipPointer.innerHTML = L_gszTooltipPointer_StaticText;
  453. }
  454.  
  455. function TaskpadTooltipShow()
  456. {
  457.     // Load in appropriate tooltip text from the module-level string array
  458.     tdTooltip.innerHTML = gaszBtnTooltips[giTooltipIndex];
  459.     
  460.     // Position the tooltip vertically
  461.   SetTooltipVertical();
  462.  
  463.     // Position the tooltip horizontally
  464.   SetTooltipHorizontal();
  465.   
  466.     // Show the tooltip & pointer
  467.     divTooltip.style.visibility = "visible";
  468.     divTooltipPointer.style.visibility = "visible";
  469. }
  470.  
  471. function SetTooltipVertical()
  472. {
  473.     // Get offset and scroll values for containing div and symbol
  474.     var divScrollTop = divSymbolContainer.scrollTop;
  475.     var divOffsetHeight = divSymbolContainer.offsetHeight
  476.     var elOffsetTop = document.all("divSymbol_" + gszLastBtn).offsetTop;
  477.  
  478.     // Calculate the relative position of the top of the
  479.     // selected button within the divSymbolContainer
  480.     var iBtnLoc = Math.floor(((elOffsetTop - divScrollTop) / divOffsetHeight) * 100);
  481.             
  482.     // If the button location is <= 50
  483.     if (iBtnLoc <= 50) {
  484.         // Position the tooltip below the button
  485.         SetTooltipVerticalBelow();
  486.     }
  487.     else {
  488.         // Otherwise, position the tooltip above the button
  489.         SetTooltipVerticalAbove();
  490.     }
  491. }
  492.  
  493. function SetTooltipVerticalAbove()
  494. {
  495.     var iYLoc = document.all("divSymbol_" + giTooltipIndex).offsetTop;
  496.     iYLoc += divSymbolContainer.offsetTop;
  497.     iYLoc -= tblTooltip.offsetHeight;
  498.     
  499.     // Subtract scrollTop to account for container div scrolling
  500.     iYLoc -= divSymbolContainer.scrollTop;
  501.     
  502.     // Offset the tooltip by an additional fixed-constant size of the symbol fontSize
  503.     switch (gaiBtnObjectType[giTooltipIndex])
  504.     {
  505.         // Offset the top by an additional fixed-constant size
  506.         case 1:     // Symbol
  507.             iYLoc -= (GetPixelSize(document.all("spanSymbol_" + giTooltipIndex).style.fontSize) * L_ConstTooltipOffsetBottom_Number);
  508.             break;
  509.  
  510.         case 2:     // GIF Vanilla
  511.         case 3:     // GIF Chocolate
  512.         case 4:     // Raster
  513.             iYLoc -= ((document.all("imgTaskBtn_" + giTooltipIndex).offsetHeight) * L_ConstTooltipOffsetBottom_Number);
  514.             break;
  515.               
  516.         default:
  517.             // Stub
  518.             break;
  519.     }    
  520.  
  521.     // Position the tooltip vertically
  522.     divTooltip.style.pixelTop = iYLoc;
  523.     
  524.     // Position the tooltip pointer vertically
  525.     divTooltipPointer.style.pixelTop = iYLoc + tblTooltip.offsetHeight - (GetPixelSize(divTooltipPointer.style.fontSize) / L_ConstTooltipPointerOffsetBottom_Number);
  526. }
  527.  
  528. function SetTooltipVerticalBelow()
  529. {
  530.     var iYLoc = document.all("divSymbol_" + giTooltipIndex).offsetTop;
  531.     iYLoc += document.all("tblSymbol_" + giTooltipIndex).offsetHeight;
  532.     iYLoc += divSymbolContainer.offsetTop;
  533.     
  534.     // Subtract scrollTop to account for container div scrolling
  535.     iYLoc -= divSymbolContainer.scrollTop;
  536.     
  537.     // Offset the tooltip by an additional fixed-constant size of the symbol fontSize
  538.     switch (gaiBtnObjectType[giTooltipIndex])
  539.     {
  540.         // Offset the top by an additional fixed-constant size
  541.         case 1:     // Symbol
  542.             iYLoc += (GetPixelSize(document.all("spanSymbol_" + giTooltipIndex).style.fontSize) * L_ConstTooltipOffsetBottom_Number);
  543.             break;
  544.  
  545.         case 2:     // GIF Vanilla
  546.         case 3:     // GIF Chocolate
  547.         case 4:     // Raster
  548.             iYLoc += ((document.all("imgTaskBtn_" + giTooltipIndex).offsetHeight) * L_ConstTooltipOffsetBottom_Number);
  549.             break;
  550.               
  551.         default:
  552.             // Stub
  553.             break;
  554.     }    
  555.  
  556.     // Position the tooltip vertically
  557.     divTooltip.style.pixelTop = iYLoc;
  558.     
  559.     // Position the tooltip pointer vertically
  560.     //divTooltipPointer.style.pixelTop = iYLoc - tblTooltip.offsetHeight - (GetPixelSize(divTooltipPointer.style.fontSize) / L_ConstTooltipPointerOffsetBottom_Number);
  561.     divTooltipPointer.style.pixelTop = iYLoc - (GetPixelSize(divTooltipPointer.style.fontSize) / L_ConstTooltipPointerOffsetTop_Number);
  562. }
  563.  
  564. function SetTooltipHorizontal()
  565. {
  566.     var iSymbolLeft = document.all("divSymbol_" + giTooltipIndex).offsetLeft;
  567.     var iSymbolWidth = document.all("divSymbol_" + giTooltipIndex).offsetWidth;
  568.     var iTooltipWidth = document.all("divTooltip").offsetWidth;
  569.  
  570.     // Center the tooltip horizontally w/ respect to its symbol
  571.     var iXLoc;
  572.     if (iSymbolWidth >= iTooltipWidth) {
  573.         // Symbol is wider than tooltip
  574.         iXLoc = ( (iSymbolWidth - iTooltipWidth) / 2) + iSymbolLeft;
  575.     }
  576.     else {
  577.         // Tooltip is wider than symbol
  578.         iXLoc = ( (iTooltipWidth - iSymbolWidth) / 2) + iSymbolLeft;
  579.     }
  580.  
  581.     iXLoc += divSymbolContainer.offsetLeft;
  582.  
  583.     // Position the tooltip horizontally
  584.     divTooltip.style.left = iXLoc;
  585.     
  586.     // Position the tooltip pointer horizontally
  587.     divTooltipPointer.style.pixelLeft = iXLoc + (iTooltipWidth / 2) - (GetPixelSize(divTooltipPointer.style.fontSize) / 2 );
  588. }
  589.  
  590. function TaskpadTooltipHide()
  591. {
  592.     divTooltip.style.visibility = "hidden";
  593.     divTooltipPointer.style.visibility = "hidden";
  594.     window.clearTimeout(gTooltipTimer);
  595.     //Empty the innerHTML, which causes the height to collapse
  596.     tdTooltip.innerHTML = "";
  597. }
  598.  
  599. //****************
  600. // RESIZE FUNCTION
  601. //****************
  602.  
  603. function ResizeTaskpadElements(iTaskpadStyle)
  604. {
  605.   var iSmallerDimension = GetSmallerDimension();
  606.     
  607.     // Bail out if iSmallerDimension < 1
  608.     if (iSmallerDimension <= 0) {
  609.         return;
  610.     }
  611.   
  612.     // Title & description
  613.     divTitle.style.fontSize = iSmallerDimension * L_ConstTitleText_Number;
  614.     divDescription.style.fontSize = iSmallerDimension * L_ConstDescriptionText_Number;
  615.  
  616.     // Watermark
  617.     // Note: Not all flavors of watermark support have been implemented
  618.     switch (iTaskpadStyle)
  619.     {
  620.         case CON_TASKPAD_STYLE_VERTICAL1:
  621.             tdWatermark.style.fontSize = iSmallerDimension * L_ConstWatermarkVerticalText_Number;
  622.             break;
  623.             
  624.         case CON_TASKPAD_STYLE_HORIZONTAL1:
  625.             tdWatermark.style.fontSize = iSmallerDimension * L_ConstWatermarkHorizontalText_Number;
  626.             break;
  627.             
  628.         case CON_TASKPAD_STYLE_NOLISTVIEW:
  629.             tdWatermark.style.fontSize = iSmallerDimension * L_ConstWatermarkNoListviewText_Number;
  630.             break;
  631.     }
  632.  
  633.     // Tooltips
  634.     tblTooltip.style.fontSize = iSmallerDimension * L_ConstTooltipText_Number;
  635.     divTooltipPointer.style.fontSize = iSmallerDimension * L_ConstTooltipPointerText_Number;    
  636.  
  637.     // Listview elements
  638.     if (iTaskpadStyle != CON_TASKPAD_STYLE_NOLISTVIEW) {
  639.         tdLVButton_0.style.fontSize = iSmallerDimension * L_ConstLVButtonText_Number;
  640.         tdLVTitle.style.fontSize = iSmallerDimension * L_ConstLVTitleText_Number;
  641.     }
  642.   
  643.   // Apply multipliers to symbol text
  644.   for (var i = 0; i <= giTotalButtons; i++) {
  645.   
  646.     // All buttons have an anchor caption
  647.     document.all("anchorCaption_" + i).style.fontSize = iSmallerDimension * L_ConstSpanAnchorText_Number;
  648.   
  649.     // Determine button type (either symbol- or image-based)
  650.     switch (gaiBtnObjectType[i])
  651.     {
  652.       case 1:     // Symbol
  653.         document.all("spanSymbol_" + i).style.fontSize = iSmallerDimension * L_ConstSpanSymbolText_Number;
  654.         break;
  655.         
  656.       case 2:     // GIF Vanilla
  657.       case 3:     // GIF Chocolate
  658.       case 4:     // Raster
  659.         document.all("imgTaskBtn_" + i).style.width = iSmallerDimension * L_ConstTaskButtonBitmapSize_Number;
  660.         document.all("imgTaskBtn_" + i).style.height = iSmallerDimension * L_ConstTaskButtonBitmapSize_Number;
  661.         break;
  662.         
  663.       default:
  664.         alert(L_UnrecognizedImageFormat_ErrorMessage + i);        
  665.     }
  666.   }
  667. }
  668.  
  669. //******************
  670. // UTILITY FUNCTIONS
  671. //******************
  672.  
  673. function SynchColorsToSystem(iType)
  674. {
  675.     // Use CSS system constants
  676.     divTitle.style.color = "threeddarkshadow";
  677.     divTitle.style.borderColor = "threeddarkshadow";
  678.  
  679.     divDescription.style.color = "threeddarkshadow";
  680.             
  681.     tblTooltip.style.backgroundColor = "infobackground";
  682.     tblTooltip.style.color = "infotext";
  683.     divTooltipPointer.style.color = "windowframe";
  684.     
  685.     // Special case the taskpad type
  686.     switch (iType) {
  687.         case CON_TASKPAD_STYLE_VERTICAL1:
  688.         case CON_TASKPAD_STYLE_HORIZONTAL1:
  689.             divLVContainerTop.style.backgroundColor = "buttonface";
  690.             divLVButton_0.style.backgroundColor = "threedshadow";
  691.             break;
  692.             
  693.         case CON_TASKPAD_STYLE_NOLISTVIEW:
  694.             // Stub
  695.             break;
  696.     }
  697. }
  698.